<?php 

namespace app\supermanager\controller;
use app\common\traits\controller\TraitController;
use think\Loader;
/**
 * 总公司退押金类
 */
class QuitDeposit extends \think\Controller
{
	use TraitController;
    const ORDER_REFUND_ON = 102; //退款中
 	const ORDER_REFUND_FINISH = -2;//退款完成
    protected function init(){
		if (!model('Managers')->checkLogin()) {
            $this->redirect('@manager/login');
            exit;
        }
		$this->model = Loader::model('QuitDeposits');
	}
	/**
	 * 取消订单等待退款的
	 */
	public function getCancelRefundOn(){
		$query = $this->request->get();
		$order = $this->model->getOrders(array_merge($query,['status' => self::ORDER_REFUND_ON]));
	    return view('quit_deposit/cancel_refund_on',['order'=>$order]);
	}
	
	/**
	 * 取消订单退款完成的订单信息.......................................
	 */
	public function getCancelRefundFinish(){
		$query = $this->request->get();
		$order = $this->model->getOrders(array_merge($query,['status' => self::ORDER_REFUND_FINISH]));
	    return view('quit_deposit/cancel_refund_finish',['order'=>$order]);
	}
	
	/**
	 * 取消订单退款
	 */
	public function getCancelQuitDeposit(){
		Loader::model('\\app\\common\\model\\Orders')->completeRefund($this->request->get('num'));
		$this->success('退款成功','/QuitDeposits/cancelrefundfinish');
	}
	
	/**
	 * 订单详情
	 */
	public function getCancelOrderRead(){
		$order = Loader::model('\\app\\common\\model\\Orders')->get(['number'=>$this->request->get('num')]);
		$quit_deposit = $this->model->get(['number'=>$this->request->get('num')]);
	    return view('quit_deposit/read',['order'=>$order,'quit_deposit'=>$quit_deposit]);	
	}
}






 ?>